package org.dtrd.modules.questionnaire.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.questionnaire.entity.bean.QuestionnaireLifewayDetail;

import java.util.Date;


/**
 * <p>
 * 
 * </p>
 *
 * @author QR
 * @since 2022-03-01
 */
@Getter
@Setter
@TableName("dtrd_ent_questionnaire_rd_lifeway")
public class DtrdEntQuestionnaireRdLifeway {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 患者id
     */
    @TableField("patient_id")
    private Integer patientId;

    /**
     * 名字
     */
    @TableField("name")
    private String name;

    /**
     * 电话
     */
    @TableField("phone")
    private String phone;

    /**
     * 年龄
     */
    @TableField("age")
    private Integer age;

    /**
     * 性别, 1-男, 2-女
     */
    @TableField("sex")
    private Integer sex;

    /**
     * 身高
     */
    @TableField("height")
    private Float height;

    /**
     * 体重
     */
    @TableField("weight")
    private Float weight;

    /**
     * 婚姻状况, 1-已婚, 2-未婚
     */
    @TableField("marital_status")
    private Integer maritalStatus;

    /**
     * 教育状况
     */
    @TableField("education_status")
    private Integer educationStatus;

    /**
     * 收入情况
     */
    @TableField("income_status")
    private Integer incomeStatus;

    /**
     * 问卷选项
     */
    @TableField("input")
    private String input;

    /**
     * 得分
     */
    @TableField("score")
    private Integer score;

    @TableField("result")
    private String result;

    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntQuestionnaireRdLifeway init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntQuestionnaireRdLifeway parseFromDTO(QuestionnaireLifewayDetail dto) {
        dataId = dto.getDataId();
        patientId = dto.getPatientId();
        name = dto.getName();
        phone = dto.getPhone();
        age = dto.getAge();
        sex = dto.getSex();
        height = dto.getHeight();
        weight = dto.getWeight();
        maritalStatus = dto.getMaritalStatus();
        educationStatus = dto.getEducationStatus();
        incomeStatus = dto.getIncomeStatus();
        input = dto.getInput();
        score = dto.getScore();
        result = dto.getResult();
        return this;
    }


}
